Skip to main content

Server Configurations

Overview

This guide provides instructions to install and configure MAXRES Construct LCMS on Windows Server 2016 and Ubuntu 20.04 using MongoDB and PM2. The server will run MongoDB on port 27017 and MAXRES Construct on port 5000 (or custom ports as required). PM2 will be used to ensure stable process management for Node.js applications.

Objectives

By the end of this guide, you will:

  • Install and configure MongoDB for MAXRES Construct LCMS.
  • Set up PM2 for Node.js application management.
  • Install and configure MAXRES Construct LCMS.
  • Enable network access for MongoDB and MAXRES Construct.

Requirements

  • Administrator access to Windows Server 2016 or Ubuntu 20.04.
  • Basic command-line knowledge.
  • A server environment to host MongoDB and MAXRES Construct.

Roles

This guide is designed for:

  • System Administrators
  • IT Engineers

Process

1. Install MongoDB Community Edition

MongoDB is a core dependency for MAXRES Construct LCMS. Follow the steps below to install and configure it for network access on port 27017.

1.1. Windows Server 2016

1.1.1. Download and Install MongoDB
  1. Download the MSI installer from MongoDB Community Edition.
  2. Run the installer and select the option to install MongoDB as a Windows service.
  3. Complete the installation and ensure the service is running.
1.1.2. Configure MongoDB
  1. Open Command Prompt as Administrator.
  2. Navigate to the MongoDB installation directory:
    cd C:\Program Files\MongoDB\Server\6.0\bin
  3. Start MongoDB on port 27017:
    mongod --port 27017 --bind_ip_all
1.1.3. Enable Network Access
  1. Create an inbound rule in Windows Firewall to allow port 27017:
    • Go to Windows Defender Firewall > Advanced Settings > Inbound Rules > New Rule.
    • Select Port, specify TCP port 27017, and allow the connection.
  2. Verify MongoDB is accessible:
    mongo --host <server-ip> --port 27017

1.2. Ubuntu 20.04

1.2.1. Install MongoDB
  1. Add the MongoDB repository and install MongoDB:
    sudo apt update
    sudo apt install gnupg
    wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
    echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
    sudo apt update
    sudo apt install -y mongodb-org
1.2.2. Configure MongoDB
  1. Open the MongoDB configuration file:
    sudo nano /etc/mongod.conf
  2. Ensure MongoDB is configured for network access:
    net:
    port: 27017
    bindIp: 0.0.0.0
  3. Restart MongoDB:
    sudo systemctl restart mongod
1.2.3. Enable Network Access
  1. Allow port 27017 through the firewall:
    sudo ufw allow 27017/tcp
  2. Verify MongoDB is accessible:
    mongo --host <server-ip> --port 27017

2. Install PM2 for Process Management

PM2 ensures that MAXRES Construct and other Node.js applications remain online and restart if they crash.

2.1. Install PM2

2.1.1. Windows Server 2016
  1. Open Command Prompt or PowerShell as Administrator.
  2. Install PM2 globally:
    npm install pm2 -g
2.1.2. Ubuntu 20.04
  1. Open a terminal.
  2. Install PM2 globally:
    sudo npm install pm2 -g

2.2. Verify Installation

  1. Run the following command to verify PM2 installation:
    pm2

3. Install and Configure MAXRES Construct LCMS

3.1. Install MAXRES Construct

3.1.1. Windows Server 2016
  1. Clone the MAXRES Construct repository:
    git clone https://github.com/yourrepo/maxres-construct.git
  2. Navigate to the project directory and install dependencies:
    cd maxres-construct
    npm install
3.1.2. Ubuntu 20.04
  1. Clone the repository and install dependencies:
    git clone https://github.com/yourrepo/maxres-construct.git
    cd maxres-construct
    npm install

3.2. Configure MAXRES Construct

  1. Edit the configuration file (e.g., .env or config.json) to set the port to 5000:
    {
    "port": 5000
    }

3.3. Start MAXRES Construct Using PM2

  1. Start the MAXRES Construct process using PM2:
    pm2 start server.js --name="maxres-construct"
  2. Verify the process is running:
    pm2 list
  3. Configure PM2 to restart processes on reboot:
    pm2 startup
    pm2 save

4. Managing Processes with PM2

4.1. List Active Processes

Use this command to view all processes managed by PM2:

pm2 list

4.2. Stop a Process

To stop a specific process:

pm2 stop maxres-construct

4.3. Start a Process

To restart a stopped process:

pm2 start maxres-construct

4.4. Delete a Process

To remove a process from PM2:

pm2 delete maxres-construct

4.5. View Logs

To view real-time logs:

pm2 logs maxres-construct

Logs are stored in the following locations:

  • Windows: C:\Users\<User>\.pm2\logs
  • Linux: /home/<user>/.pm2/logs